#include "model_manager.h"
#include "../model/obj_util.h"

namespace jlib {


Model *ModelManager::get (const std::string &path, FileDomain domain) noexcept {
  auto helper = getHelper();
  auto name = helper->getAbsolutePath(path.c_str(), domain);
  auto &ptr = this->_cache[name];
  if (ptr)
    return ptr;
  return ptr = Object::create<Model>(path, domain);
}


void ModelManager::clear () noexcept {
  this->_cache.clear();
}


} // namespace jlib
